package com.wlyuan.gateway.security;

import com.wlyuan.gateway.utils.ResponseUtils;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.server.ServerAuthenticationEntryPoint;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * @author yuanzheng
 */
public class ResourceAuthenticationEntryPoint implements ServerAuthenticationEntryPoint {

    @Override
    public Mono<Void> commence(ServerWebExchange serverWebExchange, AuthenticationException e) {
        return ResponseUtils.writeWith(serverWebExchange.getResponse(), e);
    }
}
